package emergency;

import movement.Location;
import dispatch.DispatchCenter;

/**
 * A class for creating a new Robbery
 */
public class Robbery extends Emergency {

	/**
	 * Variable registering this Robbery is armed or not
	 */
	private boolean armed;

	/**
	 * Variable registering this Robbery is still in progress
	 */
	private boolean inProgress;

	/**
	 * Initialize this new Robbery
	 * 
	 * @param location
	 *            The location of this Robbery
	 * 
	 * @param severity
	 *            The severity of this Robbery
	 * 
	 * @param armed
	 *            The occurrence of guns in this Robbery
	 * 
	 * @param inProgress
	 *            The info about the Robbery whether it's still in progress or
	 *            not
	 *            
	 * @param dispatchCenter
	 * 			The dispatchCenter where this Robbery has to be added to
	 * 
	 * @post The location of this robbery is set to the given location
	 * 
	 * @post The severity of this robbery is set to the given severity
	 * 
	 * @post The gun occurrence of this robbery is set to the given gun
	 *       occurrence
	 * 
	 * @post The in-progress info about this robbery is set to the given info (true/false)
	 * 
	 * @post The dispatchCenter of this Robbery is set to the given dispatchCenter
	 * 
	 * @post This robbery is added to the given dispatchcenter
	 * 
	 */
	public Robbery(Location location, Severity severity, DispatchCenter dispatchCenter, boolean armed,
			boolean inProgress) {
		super(location, severity, dispatchCenter, new EmergencyPolicyASAP());
		setArmed(armed);
		setInProgress(inProgress);
	}


	/**
	 * Getter for getting the occurrence of guns in this Robbery
	 * 
	 * @return Returns the occurrence of guns in this Robbery
	 */
	public boolean isArmed() {
		return armed;
	}

	/**
	 * Getter for getting the is-in-progress info of this Robbery
	 * 
	 * @return Returns whether this Robbery is in progress or not
	 */
	public boolean isInProgress() {
		return inProgress;
	}

	/**
	 * Method for setting the occurrence of guns in this Robbery
	 * 
	 * @param armed
	 *            The occurrence of guns in this Robbery
	 * 
	 * @post The occurrence of guns (armed) of this Robbery is set to the given
	 *       occurrence
	 */
	private void setArmed(boolean armed) {
		this.armed = armed;
	}

	/**
	 * Method for setting the in-progress info (still in progress or not)
	 * 
	 * @param inProgress
	 *            Is the Robbery still in progress ?
	 * 
	 * @post The still in progress info of this Robbery is set to the given info
	 *       (true/false)
	 */
	private void setInProgress(boolean inProgress) {
		this.inProgress = inProgress;
	}

	/**
	 * Method for creating an description of this Robbery
	 * 
	 * @return Returns the description of this Robbery
	 */
	@Override
	public String toString() {
		String output = "severity is " + getSeverity().toString()+"  =  ";
		if (armed) {
			output += "ARMED ";
		}
		output += "ROBBERY ";
		if (inProgress) {
			output += "in progress";
		}

		return output;
	}

}
